//
//  LGFollowUpHistioryCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/5/15.
//  随访历史记录

#import "LGFollowUpHistioryCell.h"

@interface LGFollowUpHistioryCell()

/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UIButton *dateBtn;
/**   */
@property (nonatomic , strong)UILabel *medicTitle;
/**   */
@property (nonatomic , strong)UILabel *medicLabel;
/**   */
@property (nonatomic , strong)UILabel *followTitle;
/**   */
@property (nonatomic , strong)UILabel *followLabel;

@end

@implementation LGFollowUpHistioryCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    [self.dateBtn setTitle:dataDic[@"date_title"] forState:UIControlStateNormal];
    self.medicLabel.text = dataDic[@"drug_plan"];
    self.followLabel.text = dataDic[@"followup_content"];
}

#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.clipsToBounds = YES;
    self.contentView.backgroundColor = [UIColor colorWithString:@"#F9F9F9"];
    [self.contentView addSubview:self.baseView];
    [self.contentView addSubview:self.dateBtn];
    [self.contentView addSubview:self.medicTitle];
    [self.contentView addSubview:self.medicLabel];
    [self.contentView addSubview:self.followTitle];
    [self.contentView addSubview:self.followLabel];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.equalTo(self.contentView).offset(viewPix(16));
        make.top.right.equalTo(self.contentView).offset(-viewPix(16));
    }];
    [self.dateBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.baseView);
        make.top.equalTo(self.contentView).offset(viewPix(10));
        make.width.equalTo(@(viewPix(121)));
        make.height.equalTo(@(viewPix(27)));
    }];
    [self.medicTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.dateBtn.mas_bottom).offset(viewPix(12));
        make.left.equalTo(self.baseView).offset(viewPix(16));
        make.right.equalTo(self.baseView).offset(-viewPix(16));
    }];
    [self.medicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.medicTitle.mas_bottom).offset(viewPix(8));
        make.left.right.equalTo(self.medicTitle);
    }];
    [self.followTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.medicLabel.mas_bottom).offset(viewPix(15));
        make.left.right.equalTo(self.medicTitle);
    }];
    [self.followLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.followTitle.mas_bottom).offset(viewPix(8));
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-viewPix(5));
        make.left.right.equalTo(self.medicTitle);
    }];
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:10];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}


-(UIButton *)dateBtn{
    if(!_dateBtn){
        _dateBtn = [UIButton buttonWithTitle:@"" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#1F6CC6" imageName:@""];
        _dateBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _dateBtn.titleEdgeInsets = UIEdgeInsetsMake(0, viewPix(8), 0, 0);
        [_dateBtn setBackgroundImage:[UIImage imageNamed:@"照护计划-日期背景"] forState:UIControlStateNormal];
        _dateBtn.userInteractionEnabled = NO;
    }
    return _dateBtn;
}

-(UILabel *)medicTitle{
    if(!_medicTitle){
        _medicTitle = [UILabel lableWithText:@"药物调整方案" colorString:@"#333333" textFont:LGFontWeight(13, UIFontWeightMedium) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _medicTitle;
}

-(UILabel *)medicLabel{
    if(!_medicLabel){
        _medicLabel = [UILabel lableWithText:@"" colorString:@"#999999" textFont:LGFont(14) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _medicLabel;
}

-(UILabel *)followTitle{
    if(!_followTitle){
        _followTitle = [UILabel lableWithText:@"随访建议" colorString:@"#333333" textFont:LGFontWeight(13, UIFontWeightMedium) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _followTitle;
}

-(UILabel *)followLabel{
    if(!_followLabel){
        _followLabel = [UILabel lableWithText:@"" colorString:@"#999999" textFont:LGFont(14) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _followLabel;
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
